package bbs.fragment;

import android.app.Fragment;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

import com.xkh.xkh.R;

/**
 * 和我相关的帖子
 * Created by nimi on 2015/11/12.
 */
public class WithMeFragment extends Fragment implements View.OnClickListener {
    private View rootView;

    public interface OnePostClickListener {
        void onePostClickListener();
    }

    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
    }

    public View onCreateView(LayoutInflater inflater, ViewGroup container,
                             Bundle savedInstanceState) {
        if (null != rootView) {
            ViewGroup parent = (ViewGroup) rootView.getParent();
            if (null != parent) {
                parent.removeView(rootView);
            }
        } else {
            rootView = inflater.inflate(R.layout.bbs_board, null);
        }
        return rootView;
    }

    //宿主activity处理点击事件
    @Override
    public void onClick(View v) {
        if (getActivity() instanceof OnePostClickListener) {
            ((OnePostClickListener) getActivity()).onePostClickListener();
        }
    }

    public void onDestroyView() {
        // TODO Auto-generated method stub
        super.onDestroyView();
    }

}
